%% Author: 77
%% Created: 2011-7-3
%% Description: TODO: Add description to add_node_cmd
-module(drop_node_cmd).
-author(kanghua ).  
-email(kanghua151@msn.com).  
-date("2011.07.06").  
%%
%% Include files
%%
-record(state, {
               self,                       %% self pid
			   nodeup_monitor_info_list    %% mnesia table name
			   }).

%%
%% Exported Functions
%%
-export([handle/3]).

%%
%% API Functions
%%

handle(Content,From,State) ->
	io:format("handle info ~p ~p ~p ~p ~n",[?MODULE,Content,From,State]), %% debug info
	case check_parm(Content) of 
		 true -> 
			 io:format("check parm pass ~n"),
		     {Node} = Content,
			 io:format("node info ~p ~n",[Node]), %% debug info
			 meta_data_ops:drop_node_resource(Node),
			 List = State#state.nodeup_monitor_info_list,
			 case lists:keyfind(Node,1,List) of
				 {Node,Pid} ->
					 Pid ! exit;
				 false ->
					 void
             end,
	         gen_server:reply(From, ok),
             ok;
		 false -> 
			 gen_server:reply(From,{error,err_param}),
             false
    end.
	
%%
%% Local Functions
%%

check_parm(Content)->
	true.